#ifndef EF_SOLVER1D_TDMA_H
#define EF_SOLVER1D_TDMA_H

#include "Solver1D.h"
#include "../Parallel/ParallelMPI1D.h"
class PhysicalField;

// --------------------------------------------------------------------------------------------------------------------
//Class Pusher
// --------------------------------------------------------------------------------------------------------------------
class EF_Solver1D_TDMA : public Solver1D
{

public:
    //Creator for EF_Solver1D_TDMA
    EF_Solver1D_TDMA(PicParams* params_, ParallelMPI* pmpi_, Grid* grid_, PhysicalField* fields_, Diagnostic* diag_);
    virtual ~EF_Solver1D_TDMA();

    //Overloading of () operator
    virtual void operator()(PhysicalField* fields){};
    virtual void operator()(ParallelMPI* pmpi, PhysicalField* fields, Diagnostic* diag);

    void initTDMA();
    void solve_TDMA(Field<double>* rho, Field<double>* phi, Diagnostic* diag);
    void solve_Ex(Field<double>* phi, Field<double>* Ex);

    //no source region for electric field
    void initTDMA_org();
    void solve_TDMA_org(Field<double>* rho, Field<double>* phi);
    //SuperLU parameters

    //boundary conditions for left and right sides: = 1 is Dirichlet, and = 2 is Neumann
    int bc_x_left, bc_x_right;

    //boundary field value for Dirichlet boundary condition
    double field_left, field_right;
    //boundary field gradient value (normal derivative) for Neumann boundary condition
    double field_derivative_left, field_derivative_right;

    //geometry parameters
    int nx;
    double dx;
    double dx_inv_;
    double dx_sq;

    //grid point number of source region in the left side
    int nx_source_left;

    //boundary condition of electric field for Dirichlet condition
    double bc_e_value_left, bc_e_value_right;
    //boundary condition of electric field for Neumann condition
    double bc_e_derivative_left, bc_e_derivative_right;


protected:

    double *a, *b, *c, *f, *e, *d;

};//END class

#endif

